# !/bin/bash

rpm -ivh gn-1.0.0-1.x86_64.rpm

mv /etc/yum.repos.d/openEuler.repo /etc/yum.repos.d/openEuler.repo.bk
cp openEuler.repo /etc/yum.repos.d/
yum update --assumeno
yum install dnf* -y
yum install iputils -y

echo "output to /root/rpmbuild"
cd /root
mkdir rpmbuild
cd rpmbuild

git clone https://gitee.com/src-openeuler/dsoftbus.git
mkdir SOURCES
mkdir SPECS
mv dsoftbus/dsoftbus.spec SPECS
mv dsoftbus/* SOURCES
rm -rf dsoftbus

echo "%_topdir %(echo $PWD)" | cat - /usr/lib/rpm/macros > temp && mv -f temp /usr/lib/rpm/macros

yum-builddep SPECS/dsoftbus.spec -y
rpmbuild -bp SPECS/dsoftbus.spec
